<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [evm2wasm][1]
-   [evm2wast][2]
-   [resolveFunctions][3]
-   [buildModule][4]

## evm2wasm

compiles evmCode to wasm in the binary format

**Parameters**

-   `evmCode` **[Array][5]** 
-   `opts` **[Object][6]**  (optional, default `{'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'testName':'temp','chargePerOp':false}`)
    -   `opts.stackTrace` **[boolean][7]** if `true` generates an runtime EVM stack trace (default: false)
    -   `opts.inlineOps` **[boolean][7]** if `true` inlines the EVM1 operations (default: true)
    -   `opts.testName` **[String][8]** is the name used for the wast file (default: 'temp')
    -   `opts.chargePerOp` **[boolean][7]** if `true` adds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).

Returns **[string][8]** 

## evm2wast

Transcompiles EVM code to ewasm in the sexpression text format. The EVM code
is broken into segments and each instruction in those segments is replaced
with a `call` to wasm function that does the equivalent operation. Each
opcode function takes in and returns the stack pointer.

Segments are sections of EVM code in between flow control
opcodes (JUMPI. JUMP).
All segments start at

-   the beginning for EVM code
-   a GAS opcode
-   a JUMPDEST opcode
-   After a JUMPI opcode

**Parameters**

-   `evmCode` **Integer** the evm byte code
-   `opts` **[Object][6]**  (optional, default `{'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'chargePerOp':false}`)
    -   `opts.stackTrace` **[boolean][7]** if `true` generates a stack trace (default: false)
    -   `opts.inlineOps` **[boolean][7]** if `true` inlines the EVM1 operations (default: true)
    -   `opts.chargePerOp` **[boolean][7]** if `true` adds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).

Returns **[string][8]** 

## resolveFunctions

given a Set of wasm function this return an array for wasm equivalents

**Parameters**

-   `funcSet` **[Set][9]** 
-   `wastFiles`  

Returns **[Array][5]** 

## buildModule

builds a wasm module

**Parameters**

-   `funcs` **[Array][5]** the function to include in the module
-   `imports` **[Array][5]** the imports for the module's import table (optional, default `[]`)
-   `callbacks`   (optional, default `[]`)

Returns **[string][8]** 

[1]: #evm2wasm

[2]: #evm2wast

[3]: #resolvefunctions

[4]: #buildmodule

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set
